home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / init.d / bootmisc.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2008-10-14  |  2KB  |  93 lines

  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          bootmisc
  4. # Required-Start:    hostname $local_fs
  5. # Required-Stop:
  6. # Should-Start:      udev
  7. # Default-Start:     S
  8. # Default-Stop:
  9. # Short-Description: Miscellaneous things to be done during bootup.
  10. # Description:
  11. ### END INIT INFO
  12.  
  13. PATH=/sbin:/usr/sbin:/bin:/usr/bin
  14. [ "$DELAYLOGIN" ] || DELAYLOGIN=yes
  15. . /lib/init/vars.sh
  16.  
  17. do_start () {
  18.     #
  19.     # If login delaying is enabled then create the flag file
  20.     # which prevents logins before startup is complete
  21.     #
  22.     case "$DELAYLOGIN" in
  23.       Y*|y*)
  24.         echo "System bootup in progress - please wait" > /var/lib/initscripts/nologin
  25.         ;;
  26.     esac
  27.  
  28.     # Create /var/run/utmp so we can login.
  29.     : > /var/run/utmp
  30.     if grep -q ^utmp: /etc/group
  31.     then
  32.         chmod 664 /var/run/utmp
  33.         chgrp utmp /var/run/utmp
  34.     fi
  35.  
  36.     # Set pseudo-terminal access permissions.
  37.     if [ ! -e /dev/.devfsd ] && [ -c /dev/ttyp0 ]
  38.     then
  39.         chmod -f 666 /dev/tty[p-za-e][0-9a-f]
  40.         chown -f root:tty /dev/tty[p-za-e][0-9a-f]
  41.     fi
  42.  
  43.     # Update motd
  44.     uname -snrvm > /var/run/motd
  45.     [ -f /etc/motd.tail ] && cat /etc/motd.tail >> /var/run/motd
  46.  
  47.     # Save kernel messages in /var/log/dmesg
  48.     if which dmesg >/dev/null 2>&1
  49.     then
  50.         savelog -q -p -c 5 /var/log/dmesg
  51.         dmesg -s 524288 > /var/log/dmesg
  52.         chgrp adm /var/log/dmesg || :
  53.     elif [ -c /dev/klog ]
  54.     then
  55.         savelog -q -p -c 5 /var/log/dmesg
  56.         dd if=/dev/klog of=/var/log/dmesg &
  57.         sleep 1
  58.         kill $!
  59.         [ -f /var/log/dmesg ] && { chgrp adm /var/log/dmesg || : ; }
  60.     fi
  61.  
  62.     #
  63.     #    Save udev log in /var/log/udev
  64.     #
  65.     if [ -e /dev/.udev.log ]
  66.     then
  67.         mv -f /dev/.udev.log /var/log/udev
  68.     fi
  69.  
  70.     # Remove bootclean's flag files.
  71.     # Don't run bootclean again after this!
  72.     rm -f /tmp/.clean /var/run/.clean /var/lock/.clean
  73. }
  74.  
  75. case "$1" in
  76.   start|"")
  77.     do_start
  78.     ;;
  79.   restart|reload|force-reload)
  80.     echo "Error: argument '$1' not supported" >&2
  81.     exit 3
  82.     ;;
  83.   stop)
  84.     # No-op
  85.     ;;
  86.   *)
  87.     echo "Usage: bootmisc.sh [start|stop]" >&2
  88.     exit 3
  89.     ;;
  90. esac
  91.  
  92. :
  93.